<table class="qTable">
<tr>
<td class="boldTd">
Question
</td>
<td class="boldTd">
Created By
</td>
<td class="boldTd">
Creation Time
</td>
</tr>
<?php
require 'database.php';
if(isset($_GET['startIndex']))
{
	$curPage = $_GET['startIndex'];
}
else
{
	$curPage = 0;
}

$sql = "SELECT CONCAT(CONCAT(CONCAT(CONCAT(DAY(q.creationTime ),' '),
		MONTHNAME(q.creationTime)),' '),YEAR(q.creationTime)) 
		as 'cTime', CONCAT(CONCAT(u.fname,' '),lname) as uName ,q.* FROM question q 
INNER JOIN forumuser u ON u.Id = q.UserId
WHERE q.IsActive = 1";
$result = mysql_query($sql);

$pageSize = 5;
$totalRecords = mysql_num_rows($result);
$startIndex = 0;

$sql = "SELECT CONCAT(CONCAT(CONCAT(CONCAT(DAY(q.creationTime ),' '),
		MONTHNAME(q.creationTime)),' '),YEAR(q.creationTime)) 
		as 'cTime', CONCAT(CONCAT(u.fname,' '),lname) as uName ,q.* FROM question q 
INNER JOIN forumuser u ON u.Id = q.UserId
WHERE q.IsActive = 1 limit $curPage,$pageSize";

$result = mysql_query($sql);

$counter = 1;
while($recordSet = mysql_fetch_array($result))
{
$qId = $recordSet["Id"];
$subject = $recordSet["Subject"];
$creationTime = $recordSet["cTime"];
$UserId = $recordSet["uName"];

if($counter % 2 == 0)
{
	$currentStyleTd = "<td class='even'>";
}
else
{
	$currentStyleTd = "<td class='odd'>";
}
$counter++;

echo "<tr>";
echo $currentStyleTd."<a href='ViewQuestion.php?quId=$qId'>$subject</a></td>";
echo $currentStyleTd."$UserId</td>";
echo $currentStyleTd."$creationTime</td>";
echo "</tr>";
}

//$pageSize = 5;
//$totalRecords = mysql_num_rows($result);
//$startIndex = 0;
?>

</table>
<?php


$pageCounter = 1;
echo "<table  class='footerTable'><tr><td  class='boldTd'>";
while($startIndex <= $totalRecords)
{
$aClass = "";
if($curPage == $startIndex )
{
	$aClass = "class='big'";
}
	echo "<a $aClass href='QuestionList.php?startIndex=$startIndex'>".$pageCounter."</a>&nbsp;&nbsp;";
	$pageCounter++;
	$startIndex = $startIndex + $pageSize;
}
echo "</td></tr></table>";
?>